﻿
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>计划运费</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/X-admin/css/font.css" rel="stylesheet" />
    @* <script src="~/js/layui/layui.js"></script> *@
    <script src="~/X-admin/lib/layui/layui.js"></script>
    <link href="~/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/X-admin/js/jquery.min.js"></script>
    <script src="~/X-admin/js/xadmin.js"></script>
    <script src="~/js/framework/sysframework.js"></script>
    <script src="~/js/framework/commonjs.js"></script>
    <script type="text/html" id="barDemo">
        <a title="查看详情" href="javascript:;" lay-event="view" id="frmView"><i class="layui-icon">&#xe615;</i></a>
    </script>

</head>
<body>
    <div class="layui-fluid" style="width:100%;">
        <div class="layui-row layui-col-space15">
            <div id="bDiv">
            </div>
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body ">
                        <form class="layui-form layui-col-space5" name="qForm" id="qForm">
                            <div class="layui-inline layui-show-xs-block">

                                <input class="layui-input" placeholder="开始日期" autocomplete="off" name="sDate" id="sDate" style="margin-right:15px;">
                            </div>

                            <div class="layui-inline layui-show-xs-block">
                                <input class="layui-input" placeholder="结束日期" name="eDate" id="eDate" autocomplete="off" style="margin-right:15px;">
                            </div>
                            <div class="layui-inline layui-show-xs-block">

                                <input type="text" name="mCode" placeholder="记录编码" autocomplete="off" class="layui-input" id="mCode">
                            </div>
                            <div class="layui-inline layui-show-xs-block">

                                <input class="layui-input" placeholder="U8单据编码" autocomplete="off" name="outOrderCode" id="outOrderCode">
                            </div>
                          <div class="layui-inline layui-show-xs-block">

                                <input class="layui-input" placeholder="客户名称" autocomplete="off" name="customName" id="customName">
                            </div>
                      
                           

                 
                        </form>
                    </div>

                    <div class="layui-table-body" id="layui-table-main">
                        <table class="layui-hide" id="list" lay-filter="list"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>

<script>
    var mCodes = "";
    function loadData() {
        layui.use('table', function () {
            var conditon = JSON.stringify(FormToJson("qForm"));
            var table = layui.table;
            table.render({
                elem: '#list'
                , cols: [[ //标题栏
                      { type: 'checkbox' }
                    , { field: 'mCode', title: '记录编码', width: 150, totalRowText: '合计' }
                    , { field: 'outOrderCode', title: 'U8单据号', width: 120 }
                    , { field: 'customName', title: '客户名称', width: 150 }
                    , { field: 'houseName', title: '发生仓库', width: 120 }
                    , { field: 'barCodeCount', title: '件 数', width: 80, totalRow: true }
                    , { field: 'number', title: '总数量', width: 80, totalRow: true }
                    , { field: 'createtime', title: '创建时间', width: 150 }
                    , { field: 'userName', title: '制单人', width: 100 }
                    , { field: 'memo', title: '备注说明', width: 130 }
                    , { field: 'right', title: '操作', toolbar: '#barDemo', width: 70, fixed: 'right' }
                ]], done: function (res, curr, count) {
                   

                }
                // , height: $(document).height() - $('#list').offset().top - 20
                , url: "../Bar/GetDataList?dataType=srInfo&condition=" + conditon
                , skin: 'row' //表格风格
                , even: true
                , page: true //是否显示分页
                , limits: [20, 30, 50]
                , limit: 20 //每页默认显示的数量
                , totalRow: true //开启合并行
            });
            //监听工具条
            table.on('tool(list)', function (obj) {
                var data = obj.data;
                if (obj.event === 'view') {
                    var tType = data.inOutType;
                    //var tName = data.inOutTypeName;
                    var tTypes = ["pos", "sob", "sab"];
                    var isback = "0";
                    if (tTypes.includes(tType)) {
                        isback = "1";
                    }

                    InfoOpenPage('../Bar/RecordsList?mCode=' + data.mCode + "&isback=" + isback, data.mCode + "记录信息", "80%", "90%");
                  
                } 
            });
     
            //监听工具条
            table.on('checkbox(list)', function (obj) {
                var checkStatus = table.checkStatus('list');
                var codes = "";
                for (var i = 0; i < checkStatus.data.length; i++) {
                    codes += checkStatus.data[i].mCode + ",";

                }
                mCodes = codes.slice(0, -1);
            });
        });
    }
    $(function () {
        webCode = getUrlVariable("menuCode");
        BannerData(webCode, "bDiv");
    
        loadData();
    })
    layui.use(['laydate'], function () {
        var $ = layui.$;
        var laydate = layui.laydate;
        var nowTime = new Date().valueOf();
        var max = null;
        var start = laydate.render({
            elem: '#sDate',
            trigger: 'click',
            type: 'datetime',
            format: 'yyyy/MM/dd',
            max: nowTime,
            btns: ['clear', 'confirm'],

            done: function (value, date) {
                endMax = end.config.max;
                end.config.min = date; //最大时间为结束时间的开始值
                end.config.min.month = date.month - 1;
            }
        });
        var end = laydate.render({
            elem: '#eDate',
            trigger: 'click',
            type: 'datetime',
            max: 4073558400000,
            format: 'yyyy/MM/dd',
            done: function (value, date) {
                if ($.trim(value) == '') {
                    var curDate = new Date();
                    date = { 'date': curDate.getDate(), 'month': curDate.getMonth() + 1, 'year': curDate.getFullYear() };
                }
                start.config.max = date;//最小时间为开始时间的最大值
                start.config.max.month = date.month - 1;
            }
        })
    })

    /**
    确认选择
    **/
    function Confirm() {
        if (mCodes=="") {
            layer.msg("您没有选择任何数据"); return;
        } else {
            InfoOpenPage("../Plan/AddPlanFreight?mCodes="+mCodes, "添加运费", "85%", "80%", true);
        }

    }



</script>
